/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package action;

import com.opensymphony.xwork2.ActionSupport;
import dao.CategoryDAO;
import dto.Category;
import java.util.List;
import util.ConnectDB;
import util.IdbUtil;

/**
 *
 * @author duonghung1369
 */

public class BaseController extends ActionSupport{

    private  List<Category> categories;
    protected  IdbUtil _database;

    public BaseController() {
        _database = new ConnectDB();
        loadSideBar();
    }

    public String loadSideBar() {
        CategoryDAO categoryDAO = new CategoryDAO(_database);
        setCategories(categoryDAO.getCategories());
        return SUCCESS;
    }

    /**
     * @return the categories
     */
    public List<Category> getCategories() {
        return categories;
    }

    /**
     * @param categories the categories to set
     */
    public void setCategories(List<Category> categories) {
        this.categories = categories;
    }

    
}